import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import set from '@dfeidao/atom-web/local/set';
import fire from '@dfeidao/atom-web/msg/fire';
import set_node_cls from '@dfeidao/atom-web/ui/set-node-cls';
import set_nodes_cls from '@dfeidao/atom-web/ui/set-nodes-cls';
export default async function a001(fd: IFeidaoAiBrowserComponent, e: Event, f: Event) {
	// todo
	const n = e.target as HTMLDivElement;
	const t = n.getAttribute('data-t');
	const no = n.getAttribute('data-n');
	// const pno = n.getAttribute('page-no');
	/*	const n1 = f.target as HTMLDivElement;
		const ov = n1.getAttribute('data-ov');
		const vd = n1.getAttribute('data-vd');
		const vn = n1.getAttribute('data-vn');
	*/

	set(fd, "data-t", t);// 值标题
	set(fd, 'data-n', no);// 值编号
	// set(fd, 'page-no', pno);

	console.log(t);
	console.log(no);
	// console.log(pno);

	/*
		set(fd, 'data-ov', ov);
		set(fd, 'data-vd', vd);
		set(fd, 'data-vn', vn);
	*/
	console.log("a001", e.currentTarget, e.target);
	// console.log("a001", f.currentTarget, f.target);
	/*
		console.log(vd);
		console.log(vn);
	*/
	fire("zj-000002", 'a002');
	fire("zj-000003", 'a002', no);
	// fire("zj-000005", 'a002');

	const d = e.currentTarget as HTMLDivElement;// 渲染后数据
	const nodes = fd.data.node.querySelectorAll('[data-name="hidden"]');
	const ns = Array.from(nodes) as HTMLDivElement[];// 转换成数组类型
	set_nodes_cls(ns, 'bg-select', false);
	set_node_cls(d, 'bg-select', true);

	/*
		const d1 = f.currentTarget as HTMLDivElement;
		const nodes1 = fd.data.node.querySelectorAll('[data-Name="Hidden"]');
		const ns1 = Array.from(nodes1) as HTMLDivElement[];
		set_nodes_cls(ns1, 'bg-select', false);
		set_node_cls(d1, 'bg-select', true);*/
}
